/*
* Copyright (c) 2010-2011 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: Camerality OpenGL Profiler.
*
*/
#ifndef CAMERALITYGLPROFILER_H_
#define CAMERALITYGLPROFILER_H_

// INCLUDES
#include <e32base.h>
#include <EGL/egl.h>
#include <GLES/gl.h>

// FORWARD DECLARATIONS
class CPeriodic;

typedef EGLBoolean (*NOK_resource_profiling)(EGLDisplay, EGLint, EGLint*, EGLint, EGLint*);

// CLASS DECLARATION
class CCameralityGLProfiler : public CBase
    {
public:
    static CCameralityGLProfiler* NewL();
    virtual ~CCameralityGLProfiler();

public: // New methods
    void Start(EGLDisplay aDisplay);
    void Stop();
    
    TInt FreeMemory() const;

private: // Private methods
    static TInt ProfilingCallback(TAny* aInstance);
    TInt Profile();
    void Initialize(EGLDisplay aDisplay);
    void TraceProfilingData();

private: // Private constructors
    CCameralityGLProfiler();
    void ConstructL();

private: // Data

    unsigned int iTotalMem;
    unsigned int iUsedMem;
    
    /** EGL display */
    EGLDisplay  iEglDisplay;
    
    /** EGL version */
    EGLint iEGLMajor;
    EGLint iEGLMinor;

    /** EGL implementation details */
    const char* iVendor;
    const char* iVersion;
    const char* iClientAPIS;
    const char* iExtensions;
    
    /** Profiling data count and array */
    EGLint iDataCount;
    /** Profiling data array */
    EGLint* iProfilingData;

    /** Pointer to resource profiling method, if available */
    NOK_resource_profiling iEglQueryProfilingData;
    
    /** Periodic timer for profiling */
    CPeriodic* iPeriodic;
    };

#endif /* CAMERALITYGLPROFILER_H_ */
